//
//  CPYFavoriteTableViewCell.m
//  TTMusic
//
//  Created by chenpengyu on 16/4/7.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "CPYFavoriteTableViewCell.h"

@implementation CPYFavoriteTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.songImageView = [[UIImageView alloc] init];
        self.singerAndLikeLabel = [[TTMusicBaseLabel alloc] init];
        self.nameLabel = [[TTMusicBaseLabel alloc] init];
        [self.contentView addSubview:_songImageView];
        [self.contentView addSubview:_singerAndLikeLabel];
        [self.contentView addSubview:_nameLabel];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    _songImageView.frame = CGRectMake(5, 5, self.contentView.bounds.size.height - 10, self.contentView.bounds.size.height - 10);
    _songImageView.layer.masksToBounds = YES;
    _songImageView.layer.cornerRadius = (self.contentView.bounds.size.height - 10) / 2;;
    _nameLabel.frame = CGRectMake(self.contentView.bounds.size.height + 20, self.contentView.center.y - 35, self.contentView.bounds.size.width / 2, 30);
    _singerAndLikeLabel.frame = CGRectMake(self.contentView.bounds.size.height + 20 , self.contentView.center.y + 5, self.contentView.bounds.size.width / 2 , 30);
    _nameLabel.font = [UIFont systemFontOfSize:21];
    _singerAndLikeLabel.font = [UIFont systemFontOfSize:16];
}
- (void)setSongsModel:(CPYFavoriteSongsModel *)songsModel {
    _songsModel = songsModel;
    [_songImageView sd_setImageWithURL:[NSURL URLWithString:songsModel.picUrl]];
    _nameLabel.text = songsModel.name;
    _singerAndLikeLabel.text = [NSString stringWithFormat:@"%@💕%@", songsModel.singerName, songsModel.favorites];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
